package com.itany.corejava.code07_面向对象.bms;

/**
 * @author MissChen
 * @version 1.0
 * @date 2023 年11月08日 13:44
 */
public class Test{
    public static void main(String[] args) {
        // 实例 instanceof 类名
        // 判断左边是否是右边类的实例
        // 判断左边和右边的类有直接或者间接的继承关系或者实现关系

        // Child c=new Child();
        // System.out.println(c instanceof Parent);
        // System.out.println(c instanceof Act);
        // System.out.println(c instanceof Child);

        Parent c2=new Child();
        System.out.println(c2 instanceof Parent);
        System.out.println(c2 instanceof Act);
        System.out.println(c2 instanceof Child);

        System.out.println("----");
        Act c3=new Child();
        System.out.println(c3 instanceof Parent);
        System.out.println(c3 instanceof Act);
        System.out.println(c3 instanceof Child);


    }
}
class Parent{

}

interface Act{
    void eat();
}
class Child extends Parent implements Act{
    @Override
    public void eat() {
        System.out.println("我会吃饭");
    }
}